package redis_handler

import (
	"gitee.com/zaper/redis-service/constant"
	"gitee.com/zaper/redis-service/model"
	constant2 "gitee.com/zaper/service-center-client/constant"
	"os/exec"
	"path/filepath"
)

func StartRedis() {
	go func() {
		port := <-model.RedisPortChan
		command := exec.Command("taskkill", "/f", "/im", "redis-server.exe")
		_, _ = command.CombinedOutput()

		RedisConfHandler(constant2.LocalHost, port)
		cmd := filepath.Join(constant.RedisWorkspaceValue, "redis.bat")
		command = exec.Command(cmd)
		_, _ = command.CombinedOutput()
	}()
}
